package dao

import (
	"go-learn/global"
)

func HSet(key, field string, value interface{}) error {
	err := global.GvaRedis.HSet(key, field, value).Err()
	return err
}
func HGet(key, field string) (interface{}, error) {
	value, err := global.GvaRedis.HGet(key, field).Result()
	return value, err
}
func HMSet(key string, field map[string]interface{}) error {
	err := global.GvaRedis.HMSet(key, field).Err()
	return err
}
func HMGet(key string, fields ...string) ([]interface{}, error) {
	value, err := global.GvaRedis.HMGet(key, fields...).Result()
	return value, err
}
func HGetAll(key string) (map[string]string, error) {
	value, err := global.GvaRedis.HGetAll(key).Result()
	return value, err
}

/*
	...string为string类型的切片   传参格式为：”str1“，”str2“，.....或者slice...
*/
func HDel(key string, fields ...string) error {
	err := global.GvaRedis.HDel(key, fields...).Err()
	return err
}
